import { keyBy } from 'lodash-es';

export const TOKEN_KEY = 'kuaikuai';

export const API_ROOT = `http://127.0.0.1:8888`;

export enum Nationality {
  Chinese = '0',
  ForeignChinese = '2',
  Foreign = '1',
}

export const NATIONALITY_OPTIONS = [
  { label: '中国', value: Nationality.Chinese },
  { label: '外籍华人', value: Nationality.ForeignChinese },
  { label: '外籍', value: Nationality.Foreign },
];
export const USERS_OPTIONS = [
  { label: '管理员', value: '管理员' },
  { label: '用户', value: '用户' },
  { label: '访客', value: '访客' },
];
export const RATE_OPTIONS = [
  { label: '1星焯差评', value: 1 },
  { label: '2星差评', value: 2 },
  { label: '3星也不行', value: 3 },
  { label: '4星还行吧', value: 4 },
  { label: '5星牛杯', value: 5 },
];

export const NATIONALITY_MAP = keyBy(NATIONALITY_OPTIONS, 'value');

export enum BookType {
  Textbook = '1',
  ExtracurricularBook = '2',
}

export const BOOK_TYPE_OPTIONS = [
  { label: '教科书', value: BookType.Textbook },
  { label: '课外书', value: BookType.ExtracurricularBook },
];

export const BOOK_TYPE_MAP = keyBy(BOOK_TYPE_OPTIONS, 'value');
